#ifndef BANKS_H_INCLUDED
#define BANKS_H_INCLUDED
#include "Firm.h"

// Short declarations to allow classes to be recognized by each other
class DownstreamFirm;
class UpstreamFirm;

// Definition of class Bank
class Bank {
    public:
    Bank (); // Constructor
    void initialize (double input[]); // Initializer
    void calcQuantities (); // Update of bank indicators
    void calcNetWorth (); // Calculate profit and update net worth
    void goBankrupt ();

    // Methods to deal with the pointers
    void addDstrPartner (DownstreamFirm *p);
    void delDstrPartner (DownstreamFirm *p);
    void addUstrPartner (UpstreamFirm *p);
    void delUstrPartner (UpstreamFirm *p);

    // Accessor methods
    double getNetWorth ();
    double getBankIR (double l);
    void incrBadDebt (double bd);
    double getBadDebt ();
    bool checkInsolvency ();
    int getNumPartners ();

    private:
    double netWorth; // Bank indicators
    double beta, sigma, theta;
    double badDebt;
    double wage, *dstrIR, *ustrIR;

    int numDstrPartners, numUstrPartners;
    // Pointers to partners in the network
    DownstreamFirm **partnerDstrFirms;
    UpstreamFirm **partnerUstrFirms;
};

#endif // BANKS_H_INCLUDED
